import { message } from "antd"
export const PositionName = (name: string) => {
    switch (name) {
        case 'left':
            return '靠左'
        case 'right':
            return '靠右'
        case 'center':
            return '居中'
        case 'none':
            return '消失'
        case 'middleleft':
            return '左中'
        case 'middleright':
            return '右中'

    }
}

export const PeopleData = [
    {
        id: "1",
        url: "/男.png",
        ref_file: "C:\\Users\\zdy\\Desktop\\LiveTalking\\audio\\longxiang.mp3",
        avatar_id: "wav2lip256_avatar2",
        txt: '龙祥以稳如老茶的沉着和淡然，仿佛时光在其声音中慢慢沉淀，让心灵得以安放。'
    },
    {
        id: "2",
        url: "/女.png",
        ref_file: "C:\\Users\\zdy\\Desktop\\LiveTalking\\audio\\longyue.wav",
        avatar_id: "wav2lip256_avatar3",
        txt: '龙悦以抑扬顿挫、韵味十足的评书腔调，生动讲述故事，引领听众步入传奇世界！'
    },
];

// 检查音频时长
export const checkAudioDuration = (file: File): Promise<boolean> => {
    return new Promise((resolve) => {
        const audio = new Audio();
        const reader = new FileReader();

        reader.onload = (e) => {
            audio.src = e.target?.result as string;
            audio.onloadedmetadata = () => {
                if (audio.duration > 10) {
                    message.error('音频时长不能超过10秒');
                    resolve(false);
                } else {
                    resolve(true);
                }
            };
        };
        reader.readAsDataURL(file);
    });
};


export const PeoplePositionsOptions = [
    { label: '靠右', value: 'right' },
    { label: '靠左', value: 'left' },
    { label: '居中', value: 'center' },
    { label: '消失', value: 'none' },
    { label: '左中', value: 'middleleft' },
    { label: '右中', value: 'middleright' }
]

export const PeopleFastOptions = [
    { label: '慢', value: 0.5 },
    { label: '正常', value: 1 },
    { label: '微快', value: 1.2 },
    { label: '快', value: 1.5 },
    { label: '极快', value: 2 }
]


